﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Sundry.IBLL;
using Sundry.BLL;
using Sundry.Model;
using System.Text;
using Sundry.App_Start.Common;

namespace Sundry.Areas.Admin.Controllers
{
    [Sundry.App_Start.AdminLoginAuthor]
    public class LogController : Controller
    {
        //
        // GET: /Admin/Log/

        #region =========登陆日志列表=========
        /// <summary>
        /// 登陆日志列表
        /// </summary>
        /// <returns></returns>
        public ActionResult LoginLog()
        {
            return View();
        }
        [HttpPost]
        public JsonResult LoginLog(Sundry.Areas.Admin.Models.LogSearchModel param)
        {
           
            int allCount=0;
            var log = EntryService.GetServiceEntrace().GetAdminLoginLogService.LoadLogList(param.UserName, param.iDisplayStart, param.iDisplayLength, out allCount).ToList();
            return Json(new
            {
                sEcho = param.sEcho,
                iTotalRecords = allCount,
                iTotalDisplayRecords = allCount,
                aaData = log
            },JsonRequestBehavior.AllowGet);
        }
        #endregion

        #region =========操作日志列表=========
        public ActionResult OperationLog()
        {
            return View();
        }
        [HttpPost]
        public ActionResult OperationLog(Sundry.Areas.Admin.Models.OperationSearchModel param)
        {
            int allCount = 0;
            var log = EntryService.GetServiceEntrace().GetAdminOperationService.LoadOperstionList(param.UserName, param.Authory, param.iDisplayStart, param.iDisplayLength, out allCount).ToList();
            return Json(new
            {
                sEcho = param.sEcho,
                iTotalRecords = allCount,
                iTotalDisplayRecords = allCount,
                aaData = log
            }, JsonRequestBehavior.AllowGet);
        }
        #endregion 
    }
}
